package stu.day25_day32.day25.day3;
import stu.day25_day32.day25.all.*;

public class hw3 {
    public boolean isSameTree(TreeNode p, TreeNode q) {

        if(p==null&&q==null){
            return true;
        }
        if(p==null||q==null){
            return false;
        }
        if(p.val!=q.val){
            return false;
        }

        return isSameTree(p.right,q.right)&&isSameTree(p.left,p.left);
    }



}
